import { Directive, Input, ViewContainerRef, TemplateRef } from '@angular/core';

@Directive({
  selector: '[diyIf]'
})
export class DiyIfDirective {
  @Input()
  set diyIf(newCondition: boolean) {
    if (newCondition) {
      this.vcr.createEmbeddedView(this.tpl);
    } else {
      this.vcr.clear();
    }
  }
  constructor(private vcr: ViewContainerRef, private tpl: TemplateRef<any>) { }

}
